package com.yupi.springbootinit.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.springbootinit.api.aliyunai.model.CreateOutPaintingTaskResponse;
import com.yupi.springbootinit.model.dto.picture.*;
import com.yupi.springbootinit.model.entity.Picture;
import com.yupi.springbootinit.model.entity.User;
import com.yupi.springbootinit.model.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 图片服务
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://www.code-nav.cn">编程导航学习圈</a>
 */
public interface PictureService extends IService<Picture> {

    void checkPictureAuth(User loginUser, Picture picture);
    /**
     * 校验数据
     *
     * @param picture
     * @param add 对创建的数据进行校验
     */
    void validPicture(Picture picture, boolean add);

    /**
     * 获取查询条件
     *
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);
    
    /**
     * 获取图片封装
     *
     * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 分页获取图片封装
     *
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);



    /**
     * 上传图片
     *
     * @param inputSource
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    void doReviewPicture(PictureReviewRequest pictureReviewRequest,User loginUser);

    void fillReviewParams(Picture picture,User loginUser);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return 成功创建的图片数
     */
    int uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );

    /**
     * 根据颜色搜索图片
     *
     * @param picColor
     * @param loginUser
     * @param spaceId
     * @return
     */
    List<PictureVO> searchPictureByColor(String picColor, User loginUser, Long spaceId);

    /**
     * 批量edit图片
     *
     * @param pictureEditByBatchRequest
     * @param loginUser
     */
    void editPictureBybatch(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);

    CreateOutPaintingTaskResponse createPictureOutPaintingTask(
            CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);
//    void editPictureBybatchWithThread(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);
}
